<template>
  <div>
    <el-alert
    title="一共17条数据"
    type="info" >
  </el-alert>
    <el-table
    :data="dateList"
    style="width: 100%">
    <el-table-column
     align="center"
      prop="number"
      label="考试编号"
     >
    </el-table-column>
    <el-table-column
     align="center"
      prop="subject"
      label="学科"
      >
    </el-table-column>
    <el-table-column
    align="center"
      prop="catalog"
      label="目录"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="questionType"
      label="题型"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="question"
      label="题干"
      height=50px
      >
    </el-table-column>
    <el-table-column prop="addDate" label="录入时间" width="200px">
 <template #default="scope">
{{parseTimeByString(scope.row.addDate)}}
</template>
    </el-table-column>
    <el-table-column
    align="center"
      prop="difficulty"
      label="难度"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="creator"
      label="录入人"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="chkState"
      label="审核状态"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="chkRemarks"
      label="审核意见"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="chkUser"
      label="审核人"
     >
    </el-table-column>
    <el-table-column
    align="center"
      prop="publishState"
      label="发布状态"
     >
    </el-table-column>
    <el-table-column
      fixed="right"
      align="center"
      label="操作"
      width="300">
      <template v-slot>
        <el-button  type="text" size="mini" @click="openPreview">预览</el-button>
        <el-button type="text" size="mini" @click="openAudit">审核</el-button>
        <el-button type="text" size="mini">修改</el-button>
        <el-button type="text" size="mini" @click="xia" >下架</el-button>
        <el-button type="text" size="mini">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  <!-- 预览组件 -->
    <questionsPreview ref="refPreview"></questionsPreview>
    <!-- 审核组件 -->
    <questionAudit ref="refAudit"></questionAudit>
  </div>
</template>

<script>
// 引入预览组件
import questionsPreview from '../components/questions-preview.vue'
import questionAudit from '../components/question-audit.vue'
import { parseTimeByString } from '@/filters/index.js'

export default {
  name: '',
  components: { questionsPreview, questionAudit },

  props: {
    dateList: {
      type: Array,
      default: () => []
    }
  },
  setup () {
    return {
      parseTimeByString
    }
  },
  data () {
    return {

    }
  },
  methods: {
    // 显示预览框
    openPreview () {
      this.$refs.refPreview.dialogVisible = true
    },
    // 显示审核框
    openAudit () {
      this.$refs.refAudit.dialogVisible = true
    }
    // parseTimeByString () {
    //   // parseTimeByString()
    //   console.log(1)
    // }
  }
}
</script>

<style scoped>

</style>
